<template>
  <div class="consultation">
    <h2>系统维护管理</h2>
    <div class="consultation-block">
      <h4>系统公告：</h4>
      <el-input
        type="textarea"
        :rows="4"
        maxlength="50"
        placeholder="请输入内容"
        show-word-limit
        style="margin-top: 20px;"
        v-model="notice">
      </el-input>
      <div style="text-align: center;">
        <el-button style="margin: 20px auto;" size="mini" type="danger" @click="updateData">确认编辑</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import { getPrice, updatePrice } from "../service.js";
export default {
  name: "home",
  beforeCreate() {
    getPrice().then(res => {
      this.form = res.data.data[0]
      this.notice = res.data.data[0].notice
    })
  },
  data() {
    return {
      notice: ''
    };
  },
  methods: {
    updateData() {
      updatePrice(this.form.id, {
        notice: this.notice
      }).then(res => {
        if (res.code === 200) {
          this.$message.success('修改成功')
          location.reload()
        }
      })
    },
  },
};
</script>

<style scoped>
h2 {
  text-align: center;
  margin-top: 20px;
  margin-bottom: 20px;
}
.consultation-block {
  width: 90%;
  margin-left: 5%;
}

.pagination {
  text-align: center;
  margin-top: 20px;
}
.el-tag + .el-tag {
  margin-left: 10px;
}
.button-new-tag {
  margin-left: 10px;
  height: 32px;
  line-height: 30px;
  padding-top: 0;
  padding-bottom: 0;
}
.input-new-tag {
  width: 90px;
  margin-left: 10px;
  vertical-align: bottom;
}

.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 60px;
  height: 60px;
  line-height: 60px;
  border: 1px dashed gray;
  text-align: center;
}
.avatar {
  width: 60px;
  height: 60px;
  display: block;
}
.img-blocks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.el-icon-circle-close {
  position: absolute;
  top: -5px;
  right: -5px;
  cursor: pointer;
  color: red;
}
</style>
